	<?php get_header(); ?>
    
 <?php
		if ( get_post_type() == 'portfolio' )
		{
			if( have_posts() ) :

				while( have_posts() ) : the_post();
				
					$terms = get_the_terms( $post->ID, 'department' );
					$on_draught = '';
					
				if ( $terms && ! is_wp_error( $terms ) ) :
					
					$draught_links = array();

					foreach ( $terms as $term )
					{
						$draught_links[] = $term->name;
					}
			
					$on_draught = join( ", ", $draught_links );
					
				endif;
				?>  
                   
<div class="page-bg" style="background-image:url(<?php echo get_template_directory_uri(); ?>/resources/img/generalheader.jpg)"><p><?php the_title(); ?></p></div>

<!-- Content -->
<div class="container">
	<div class="clearfix">
		<div class="row"><!-- Main -->
			<div id="blog" class="span8">
 <?php
						if ( get_post_meta( $post->ID, 'portfoio_format_type2', true ) )
						{
						?>
          <article>
          	<div class="post">
               <div id="banner">
                	<section class="flexslider">
                  		<ul class="slides">
                     <?php
										if ( get_post_meta( $post->ID, 'upload_one', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_one', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_two', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_two', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_three', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_three', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_four', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_four', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_five', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_five', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_six', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_six', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_seven', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_seven', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_eight', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_eight', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_nine', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_nine', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
										
										if ( get_post_meta( $post->ID, 'upload_ten', true ) != "" )
										{ ?><li><img src="<?php  echo get_post_meta( $post->ID, 'upload_ten', true ); ?>" alt="<?php the_title(); ?>" /></li><?php }
									?>
                                  </ul>
                                  </section>
                                  </div>
				  <div class="text"><p><?php the_content(); ?></p></div>
                  <div class="marginbottom40"></div>

                </div>
                </article>

          

        
              <?php
						}
						elseif ( get_post_meta( $post->ID, 'portfoio_format_type3', true ) )
						{
						?>
               <article>
               <div class="post">
                  <div class="video-container">
			<?php echo get_post_meta( $post->ID, 'portfolio_video_code', true ); ?>
 				  </div>
 				<div class="text"><p><?php the_content(); ?></p> </div>
                 <div class="marginbottom40"></div>
                 </div>
        <!-- /Main --> 
        
            </article>
           <?php
						}
						else
						{
						?>
            	<article>
					<div class="post">
                <!-- /Title -->
               		 <section>
                	
               <?php 
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); 
if ($image) : ?>
    <img src="<?php echo $image[0]; ?>" alt="" />
<?php endif; ?> 
                </section>
      <div class="text"><p><?php the_content(); ?></p></div>
<div class="marginbottom40"></div>
</div>
            </article>
<?php ?>
  		<?php } ?>
</div> <!-- /Main Span --> 
            <aside id="sidebar" class="span4">

            <!-- /Widget -->
            	<?php
						if ( get_post_meta( $post->ID, 'project', true ) != "" ) { echo '<section class="widgetportfolio"><h2>' . __( 'Project', 'themeText' ) . '</h2><p>' . get_post_meta( $post->ID, 'project', true ) . '</p></section>'; }
						
						if ( get_post_meta( $post->ID, 'client', true ) != "" ) { echo '<section class="widgetportfolio"><h2>' . __( 'Client', 'themeText' ) . '</h2><p>' . get_post_meta( $post->ID, 'client', true ) . '</p></section>'; }
						
						if ( get_post_meta( $post->ID, 'technology', true ) != "" ) { echo '<section class="widgetportfolio"><h2>' . __( 'Technology', 'themeText' ) . '</h2><p>' . get_post_meta( $post->ID, 'technology', true ) . '</p></section>'; }
						
						if ( get_post_meta( $post->ID, 'long_description', true ) != "" ) { echo '<section class="widgetportfolio"><h2>' . __( 'Description', 'themeText' ) . '</h2><p>' . get_post_meta( $post->ID, 'long_description', true ) . '</p></section>'; }
						
						
						
						?>
						
						<?php
						if ( get_post_meta( $post->ID, 'launch_project_url', true ) != "" )
						{
							if ( get_post_meta( $post->ID, 'project_url_new_window', true ) ) { $project_url_new_window_out = 'target="_blank"'; }
							

			echo '<div class="pfbutton"><a ' . $project_url_new_window_out . ' href="' . get_post_meta( $post->ID, 'launch_project_url', true ) . '" style="text-decoration:none;"><button class="launchbutton">'  . __( 'Launch Project', 'themeText' ) . ' &rarr;</button></a></div>';
						}
					?>
<?php
				endwhile;
			endif;
		}
	?>       
         </aside> 
        <!-- /Sidebar -->             
		</div>
	</div>
</div>
<!-- /Content -->


<?php get_footer(); ?>
                

    <!--PAGE CONTENT-->